package com.yuanlrc.base.controller.admin;

import com.yuanlrc.base.bean.PageBean;
import com.yuanlrc.base.entity.admin.Borrow;
import com.yuanlrc.base.entity.admin.Library;
import com.yuanlrc.base.entity.admin.Student;
import com.yuanlrc.base.service.admin.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Enumeration;

@RequestMapping("/show")
@Controller
public class ShowController {

    @Autowired
    private BorrowService borrowService;

    /**
     * 学生登陆时展示该学生的借阅信息
     * @param model
     * @param session
     * @return
     */
    @RequestMapping(value="/list")
    public String list(Model model,HttpSession session,PageBean<Borrow> pageBean,Borrow borrow){
        Student student = (Student) session.getAttribute("ylrc_student");
        Long id = student.getId();
        model.addAttribute("title","借阅信息");
//        model.addAttribute("student",borrow.getStudent());
        model.addAttribute("id",id);
        model.addAttribute("pageBean",borrowService.findList(pageBean,borrow,id));
        return "admin/show/borrow2";
    }


}
